package com.hornsun.repository;

import com.google.common.base.Preconditions;
import com.hornsun.domain.dbo.AdministratorExample;
import com.hornsun.repository.mapper.AdministratorMapper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

/**
 * Created by 编译中... on 2018/5/23.
 */
@Repository
public class AdministratorRepository {
    @Resource
    private AdministratorMapper administratorMapper;

    public boolean checkAccountInfo(String account , String password){
        Preconditions.checkNotNull(account);
        Preconditions.checkNotNull(password);
        AdministratorExample administratorExample = new AdministratorExample();
        AdministratorExample.Criteria criteria = administratorExample.createCriteria();
        criteria.andAccountEqualTo(account).andPasswordEqualTo(password);
        return administratorMapper.countByExample(administratorExample) == 1;
    }

}
